package 力扣日常刷题.木22二月.第22天228;

/**
 * @author 帅小伙
 * @date 2022/2/28
 * @description
 */
public class Demo181连续整数求和 {

    public int consecutiveNumbersSum(int n) {
        int ans = 1;
        for (int i = 2; i < Math.sqrt(2 * n); i++) {
            if((n - i *(i - 1)/2) % i == 0) ++ans;
        }
        return ans;
    }

}
